package com.logistics.map.entity.model;

import com.logistics.inventory.entity.domain.InventoryDetail;
import com.logistics.pick.entity.domain.PickDetail;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class GoodsRow {

    //物料名称
    private String name;

    //物料数量
    private BigDecimal qty;

    //物料单位
    private String unit;

    //物料编号
    private String code;

    //任务号
    private String taskNo;


    public GoodsRow(PickDetail pickDetail) {
        this.name = pickDetail.getItemName();
        this.qty = pickDetail.getItemQty();
        this.unit = pickDetail.getItemUnit();
        this.code = pickDetail.getItemCode();
        this.taskNo = pickDetail.getItemWorkcode();
    }

    public static GoodsRow build(PickDetail pickDetail) {
        return new GoodsRow(pickDetail);
    }

    public GoodsRow(InventoryDetail inventoryDetail) {
        this.name = inventoryDetail.getItemName();
        this.qty = inventoryDetail.getItemQty();
        this.unit = inventoryDetail.getItemUnit();
        this.code = inventoryDetail.getItemCode();
        this.taskNo = inventoryDetail.getItemWorkcode();
    }

    public static GoodsRow build(InventoryDetail inventoryDetail) {
        return new GoodsRow(inventoryDetail);
    }
}